/*
 * Object.h
 *
 *  Created on: May 13, 2012
 *      Author: walther
 */

#ifndef OBJECT_H_
#define OBJECT_H_

#include "Vector4D.h"
#include "Ray.h"

class Object
{
public:
    
    /** Types of objects that can be rendered */
    enum ObjectType
    {
        SPHERE,
        BOX,
        TRIANGLE
    };
    
    /**
     * Destructor
     */
    virtual ~Object(){}
    
    /**
     * Computes the intersection of the object with the given ray
     * @param ray Ray that may intersect the object
     * @param t Parameter of the ray, indicating how far from the ray origin is 
     *          the intersection
     * @return true if intersects, false otherwise
     */
    virtual bool computeRayIntersection( Ray& ray, double& t ) = 0;
    
    /**
     * Gives the Normal vector of the object at a given point.
     * If the point is not in the object's surface, returns null vector (0,0,0,1)
     * @param point Point in the object's surface
     * @return the Normal vector of the object
     */
    virtual Vector4D getNormal( Vector4D& point ) = 0;
    
    /**
     * Sets the id of the object's material.
     * All the materials are stored in the Scene class.
     * @param materialId Id of the material
     */
    virtual void setMaterial( int materialId ) = 0;
    
    /**
     * @return The Id of the object's material
     */
    virtual int getMaterialId() = 0;
    
    /**
     * @return The type of the object
     */
    virtual ObjectType getType() = 0;
    
    /**
     * Gives access to the min and maximum values of the axis aligned bounding 
     * box of the object
     * @param min Minimum values of the aabb
     * @param max Maximum values of the aabb
     */
    virtual void getBoundingBox( Vector4D& min, Vector4D& max ) = 0;
};

#endif /* OBJECT_H_ */
